package cn.juque.methodfactory.factory;

import cn.juque.common.exception.AppException;
import cn.juque.methodfactory.service.ModelEnum;
import cn.juque.methodfactory.service.PipelineService;
import cn.juque.simplefactory.product.Tesla;

/**
 * @author juque
 * @version 1.0.0
 * <ul>
 *     <li>SuperFactory</li>
 * </ul>
 * @date 2023-06-11 14:42:29
 **/
public class SuperFactory {

    private SuperFactory() {
    }

    public static Tesla createCar(String model) {
        PipelineService pipelineService = ModelEnum.forPipeline(model);
        if (null == pipelineService) {
            throw new AppException("无法启动流水线");
        }
        return pipelineService.create();
    }
}
